package priv.web.control;

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import priv.web.util.ReviewJDBCUtil;

import com.alibaba.fastjson.JSON;

public class Shangcheng extends HttpServlet{

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		String sql="select * from shangpin ";//where sp_id=3
		try {
			List<Map<String, Object>> query = ReviewJDBCUtil.query(sql);
			resp.setContentType("application/json,charset=utf-8");
			resp.getWriter().write(JSON.toJSONString(new Package(1, "", query)));
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	
	}
	
}
